﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ForumDomainModels.Mappers
{
    public class PostMapper
    {
        public ForumDomainModels.Post DataFromDatabaseToPostDomainModel(SqlDataReader reader)
        {
            ForumDomainModels.Post post = new ForumDomainModels.Post();
            post.Id = (int)reader["Id"];
            post.Title = (string)reader["Title"];
            post.Content = (string)reader["Content"];
            post.DatePublished = (DateTime)reader["DatePublished"];
            post.AuthorId = (int)reader["AuthorId"];
            post.CategoryId = (int)reader["CategoryId"];
            return post;
        }
    }
}
